parse: Add 'k' (kilometers) as possible unit to parse_distance.
authoroliskoli <oliskoli>
Thu, 21 Aug 2008 22:03:38 +0000 (22:03 +0000)
committeroliskoli <oliskoli>
Thu, 21 Aug 2008 22:03:38 +0000 (22:03 +0000)
parse.c

diff --git a/parse.c b/parse.c
index d0217c4a4f6d77ddfdfac1f1c5619ce73cad097d..9c5e47e35db2b31f69efaf3df80b98fe98427afc 100644 (file)
--- a/parse.c
+++ b/parse.c
@@ -64,6 +64,7 @@ parse_distance(const char *str, double *val, double scale, const char *module)
        if (case_ignore_strcmp(unit, "m") == 0) /* do nothing, that's our standard */;
        else if (case_ignore_strcmp(unit, "ft") == 0) *val = FEET_TO_METERS(*val);
        else if (case_ignore_strcmp(unit, "feet") == 0) *val = FEET_TO_METERS(*val);
+       else if (case_ignore_strcmp(unit, "k") == 0) *val *= 1000.0;
        else if (case_ignore_strcmp(unit, "km") == 0) *val *= 1000.0;
        else if (case_ignore_strcmp(unit, "nm") == 0) *val = NMILES_TO_METERS(*val);
        else if (case_ignore_strcmp(unit, "mi") == 0) *val = MILES_TO_METERS(*val);